//
//  SignInOfCell.m
//  MY Project For Sport
//
//  Created by admin on 16/2/12.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "SignInOfCell.h"
#import "ModelOfSignIn.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <DKNightVersion.h>

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface SignInOfCell ()

@property (nonatomic, retain)UILabel *labelForRank;
@property (nonatomic, retain)UIImageView *teamImage;
@property (nonatomic, retain)UILabel *teamName;
@property (nonatomic, retain)UILabel *signIn;
@property (nonatomic, retain)UILabel *signInNumber;

@end


@implementation SignInOfCell

- (void)dealloc {

    [_labelForRank release];
    [_teamImage release];
    [_teamName release];
    [_signIn release];
    [_signInNumber release];
    [super dealloc];
    

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {


    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);

        [self createSubView];
        
        
    }
    
    return self;

}

- (void)createSubView {

    self.labelForRank = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForRank];
    [_labelForRank release];
    
    self.teamImage = [[UIImageView alloc] init];
    [self.contentView addSubview:self.teamImage];
    [_teamImage release];
    
    self.teamName = [[UILabel alloc] init];
    [self.contentView addSubview:self.teamName];
    [_teamName release];
    
    self.signIn = [[UILabel alloc] init];
    [self.contentView addSubview:self.signIn];
    [_signIn release];
    
    self.signInNumber = [[UILabel alloc] init];
    [self.contentView addSubview:self.signInNumber];
    [_signInNumber release];
    
    

}

- (void)layoutSubviews {

    [super layoutSubviews];

    self.labelForRank.frame = CGRectMake(5 * WEIGHTT, 20 * HEIGHTT, WIDTH / 16, HEIGHT - 40 * HEIGHTT);
   // self.labelForRank.backgroundColor = [UIColor redColor];
    self.labelForRank.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
    
    self.teamImage.frame = CGRectMake(WIDTH / 16 + 15 * WEIGHTT, 10 * HEIGHTT, HEIGHT - 20 * HEIGHTT, HEIGHT - 20 * HEIGHTT);
    self.teamImage.layer.cornerRadius = (HEIGHT - 20 * HEIGHTT) / 2;
    self.teamImage.layer.masksToBounds = YES;
    
   // self.teamImage.backgroundColor = [UIColor yellowColor];
    

    self.teamName.frame = CGRectMake( WIDTH / 16 + 15 * WEIGHTT + HEIGHT - 20 * HEIGHTT + 15 * WEIGHTT , 15 * HEIGHTT, WIDTH / 3.5, HEIGHT - 30 * HEIGHTT);
    self.teamName.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
   // self.teamName.backgroundColor = [UIColor orangeColor];


    self.signIn.frame = CGRectMake(WIDTH / 4 * 3, 20 * HEIGHTT, WIDTH / 12, HEIGHT - 40 * HEIGHTT);
    self.signIn.text = @"签到 :";
    self.signIn.font = [UIFont systemFontOfSize:10];
    self.signIn.textColor = [UIColor grayColor];

    self.signInNumber.frame = CGRectMake(WIDTH / 4 * 3 + WIDTH / 12 + 5 * WEIGHTT , 20 * HEIGHTT, WIDTH / 8, HEIGHT - 40 * HEIGHTT);
    self.signInNumber.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
  //  self.signInNumber.backgroundColor = [UIColor blueColor];



}


-(void)passModelForSignIN:(ModelOfSignIn *)model {


    self.labelForRank.text = model.rank;

    [self.teamImage sd_setImageWithURL:[NSURL URLWithString:model.logo]];


    self.teamName.text = model.tname_cn;
    self.teamName.font = [UIFont systemFontOfSize:17];
    
    
    self.signInNumber.text = model.count;
    self.signInNumber.font = [UIFont systemFontOfSize:10];
    self.signInNumber.textColor = [UIColor grayColor];

    

}



- (void)awakeFromNib {
    // Initialization code
    
    
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
